<template>
  <!-- 推广统计 -->
  <SectionContainer class="u-p30">
    <SectionTitle>推广统计
      <el-tooltip
        slot="tip"
        class="item"
        effect="dark"
        placement="top"
        content="不包含已删除的计划、单元、创意"
      >
        <i class="iconfont iconfont-10 c-hint-major"></i>
      </el-tooltip>
    </SectionTitle>
    <el-row
      class="m-total"
      type="flex"
    >
      <el-col class="m-total__item">
        <div class="c-text-high u-fs36 u-mb10">
          <span
            class="u-cursor"
            @click="$router.push({ name: 'generalize-plan' })"
          >
            {{generalizeTotal.enablePlan}}<span class="c-text-major u-fs16">/{{generalizeTotal.enablePlanTotal}}</span>
          </span>
        </div>
        <div class="c-text-minor">启用计划/总量</div>
      </el-col>
      <el-col class="m-total__item">
        <div class="c-text-high u-fs36 u-mb10">
          <span
            class="u-cursor"
            @click="$router.push({ name: 'generalize-cell' })"
          >
            {{generalizeTotal.enableUnit}}<span class="c-text-major u-fs16">/{{generalizeTotal.enableUnitTotal}}</span>
          </span>
        </div>
        <div class="c-text-minor">启用单元/总量</div>
      </el-col>
      <el-col class="m-total__item">
        <div class="c-text-high u-fs36 u-mb10">
          <span
            class="u-cursor"
            @click="$router.push({ name: 'generalize-creative' })"
          >
            {{generalizeTotal.enableCreative}}<span class="c-text-major u-fs16">/{{generalizeTotal.enableCreativeTotal}}</span>
          </span>
        </div>
        <div class="c-text-minor">启用创意/总量</div>
      </el-col>
      <el-col class="m-total__item">
        <div class="c-text-high u-fs36 u-mb10">
          <span
            class="u-cursor"
            @click="$router.push({ name: 'generalize-creative' })"
          >
            {{generalizeTotal.creativeInnerAuditWait}}
          </span>
        </div>
        <div class="c-text-minor">内部待审核创意</div>
      </el-col>
    </el-row>
  </SectionContainer>
</template>

<script>
import SectionTitle from "@/components/section-title";
import SectionContainer from "@/components/section-container";

import { sessionStorage } from "@/utils";

import { fetchHomeGeneralize } from "@/api";

export default {
  components: {
    SectionTitle,
    SectionContainer
  },
  data() {
    return {
      user: sessionStorage.get("USER"),
      generalizeTotal: {}
    };
  },
  methods: {
    // 推广统计
    fetchHomeGeneralize() {
      fetchHomeGeneralize({
        query: {
          userId: this.user.userId
        }
      }).then(res => {
        this.generalizeTotal = res.data;
      });
    }
  },
  created() {
    this.fetchHomeGeneralize();
  }
};
</script>